<?php $redirectTo = (is_home() || is_front_page()) ? HOME_URL : $_SERVER['REQUEST_URI'];?>

<?php if( ! is_user_logged_in()):?>
    <a href="#" id="signin"><?php _e('Sign In', THEME_NAME); ?></a> 
	
    <!-- SignIn Dialog -->
    <div id="signinbox" class="gray_gradient"> <img src="<?php echo THEME_URL;?>/images/sign_in_arrow.png" alt="" class="boxArrow" />
        <div id="signin_menu">
            <div class="box_heading">
            <?php _e('Sign In', THEME_NAME); ?>
            
            <a href="#" class="close"><img id="fadeouta" src="<?php echo THEME_URL;?>/images/close.png" alt="" width="16" height="16" /></a> </div>
            <div class="clear">&nbsp;</div>
            <form method="post" action="<?php echo wp_login_url( get_permalink() ); ?>">
                <input type="text" class="textbox" onfocus="if(this.value == '<?php _e('Email Address', THEME_NAME); ?>') { this.value = ''; }" onblur="if(this.value == '') { this.value = '<?php _e('Email Address', THEME_NAME); ?>'; }" name="log" value="<?php _e('Email Address', THEME_NAME); ?>" />
                <input type="password" class="textbox" onfocus="if(this.value == 'Search best hospital') { this.value = ''; }" onblur="if(this.value == '') { this.value = 'Search best hospital'; }" name="pwd" value="Search best hospital" />
				
                <div class="signinStrip">
					<input id="remember" name="remember_me" value="1" type="checkbox" />
					<label for="remember"><?php _e('Remember me', THEME_NAME); ?></label>											
					<span class="forgot">
						<a href="<?php echo wp_lostpassword_url( $redirectTo ); ?>" id="resend_password_link"><?php _e('Forgot password?', THEME_NAME);?></a>
					</span>
					
					<input type="hidden" value="<?php echo $redirectTo ?>" name="redirect_to" />
					<input class="signin_submit" value="<?php _e('Submit', THEME_NAME);?>" type="submit" />
                </div>
            </form>	
        </div>
    </div>
<?php else: ?>
	<a href="<?php echo wp_logout_url($redirectTo);?>"><?php _e('Logout', THEME_NAME);?></a>
<?php endif; ?>